<template>
  <div>
    <p>收到消息：{{ message }}</p>
  </div>
</template>

<script setup>
import { ref, onUnmounted } from 'vue'
import emitter from '@/eventBus.js'

const message = ref('')

emitter.on('custom:event', (payload) => {
  message.value = payload.message
})

onUnmounted(() => {
  emitter.off('custom:event')
})
</script>
